# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: Gabriel Souza Franco
# Contributor: Florian Pritz
# Contributor: Christian Hesse <mail@eworm.de>
# Contributor: Thomas Dziedzic <gostrc@gmail.com>
# Contributor: Mickele
# Contributor: Marcus Fritzsch <fritschy@googlemail.com>

pkgname=soqt
pkgver=1.6.0
pkgrel=4
pkgdesc='The glue between Coin and Qt'
arch=(loong64 x86_64)
url='https://github.com/coin3d/soqt'
license=(GPL)
depends=(coin qt5-base)
makedepends=(cmake git mesa ninja doxygen)
# 75d4... is tag SoQt-1.6.0
# 3ff6... is tag soanydata-1_1_0
# a006... is tag soxt-1_4_0
source=("git+$url#commit=75d47669ae20f25ea4cd583c9298680254bdcff3"
        "git+${url/soqt/soanydata}#commit=3ff6e9203fbb0cc08a2bdf209212b7ef4d78a1f2"
        "git+${url/soqt/sogui}#commit=100612bf4016916dd686e2b6fecf8ac23d3db14d")
sha256sums=('SKIP'
            'SKIP'
            'SKIP')

prepare() {
  # Set up links to the support repos
  # (these are git submodules in what will be the next release)
  ln -s "$srcdir/soanydata" soqt/data
  ln -s "$srcdir/sogui" soqt/src/Inventor/Qt/common

  # Skip cpack
  mkdir -p soqt/cpack.d
  touch soqt/cpack.d/CMakeLists.txt
}

build() {
  mkdir -p build
  cd build
  cmake ../soqt \
    -DCMAKE_C_FLAGS="$CFLAGS -fPIC -Wno-deprecated-declarations" \
    -DCMAKE_CXX_FLAGS="$CXXFLAGS -fPIC -Wno-deprecated-declarations" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DSOQT_BUILD_DOC_MAN=ON \
    -DSOQT_BUILD_DOC_CHM=OFF \
    -G Ninja
  ninja
}

package() {
  DESTDIR="$pkgdir" ninja -C build install

  # Skip the HTML documentation
  rm -rf "$pkgdir/usr/share/doc"
}
